//
//  SplitExtension.swift
//  GitTFGUI
//
//  Created by Samuel Richard Magny on 2015-09-02.
//  Copyright (c) 2015 Samuel Richard Magny. All rights reserved.
//

import Foundation

extension String {
    func split(splitter: String) -> Array<String> {
        let regEx = try? NSRegularExpression(pattern: splitter, options: NSRegularExpressionOptions())
        let stop = "<SomeStringThatYouDoNotExpectToOccurInSelf>"
        let modifiedString = regEx!.stringByReplacingMatchesInString (self, options: NSMatchingOptions(),
            range: NSMakeRange(0, self.characters.count),
            withTemplate:stop)

        return modifiedString.componentsSeparatedByString(stop)
    }
    
}